Hệ thống quản lý thanh toán POS nhà hàng

1 Imports System.Data.OleDb
2 Public Class frmAvailableTables
3     Dim UserButtons As List(Of Button) = New List(Of Button)
4     Private Sub frmAvailableTables_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
5         AvailableTables()
6     End Sub
7     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
8         Try
9             Dim btn1 As Button = CType(sender, Button)
10             Dim str As String = btn1.Text.Trim()
11             con = New OleDbConnection(cs)
12             con.Open()
13             Dim cb As String =
"Update KOTGeneration set TableNo=@d1 where TableNo=@d2"
14             cmd = New OleDbCommand(cb)
15             cmd.Parameters.AddWithValue(
"@d1", str)
16             cmd.Parameters.AddWithValue(
"@d2", lblTable.Text)
17             cmd.Connection = con
18             cmd.ExecuteReader()
19             con.Close()
20             frmCustomDialog2.ShowDialog()
21             Me.Hide()
22             frmBillling.txtTableNo.Text =
""
23             frmBillling.fillTableNo()
24             frmBillling.Show()
25         Catch ex As Exception
26             MessageBox.Show(ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
27         End Try
28     End Sub
29     Sub AvailableTables()
30         Try
31             con = New OleDbConnection(cs)
32             con.Open()
33             Dim ct As String =
"select R_Table.TableNo from R_Table where R_Table.Status='Activate' and R_Table.TableNo not in (Select TableNo from KOTGeneration where Status='Unpaid')"
34             cmd = New OleDbCommand(ct)
35             cmd.Connection = con
36             rdr = cmd.ExecuteReader()
37             FlowLayoutPanel1.Controls.Clear()
38             Do While (rdr.Read())
39                 Dim btn As New Button
40                 btn.Text = rdr.GetValue(
0)
41                 btn.TextAlign = ContentAlignment.MiddleCenter
42                 btn.BackColor = Color.LightGreen
43                 btn.FlatStyle = FlatStyle.Popup
44                 btn.Width =
180
45                 btn.Height =
80
46                 btn.Font = New System.Drawing.Font(
"Microsoft Sans Serif", 15.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
47                 UserButtons.Add(btn)
48                 FlowLayoutPanel1.Controls.Add(btn)
49                 AddHandler btn.Click, AddressOf Me.Button2_Click
50             Loop
51             con.Close()
52         Catch ex As Exception
53             MessageBox.Show(ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
54         End Try
55     End Sub
56     Private Sub btnCancel_Click(sender As System.Object, e As System.EventArgs) Handles btnCancel.Click
57         Me.Close()
58     End Sub
59
60     Private Sub btnRefresh_Click(sender As System.Object, e As System.EventArgs) Handles btnRefresh.Click
61         AvailableTables()
62     End Sub
63
64 End Class


Gõ tìm kiếm nhanh...